//TIP 要<b>运行</b>代码，请按 <shortcut actionId="Run"/> 或
// 点击装订区域中的 <icon src="AllIcons.Actions.Execute"/> 图标。
class Drink  {
    //protected可以给子类使用
     static protected double  tax(int price) {
       return price*0.2;
    }

}
class FreshJuice extends Drink {//继承基本用法
    enum FreshJuiceSize{ SMALL, MEDIUM , LARGE }
    FreshJuiceSize size;
    private int price;
    public double sell() {
        if(size == FreshJuiceSize.SMALL) {
            price = 100;
        }
        else if(size == FreshJuiceSize.MEDIUM) {
            price = 200;
        }
        else if(size == FreshJuiceSize.LARGE) {
            price = 300;
        }
        return price+Drink.tax(price);
    }

}
class Person {
    protected String name;
    protected int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    void run(){
        System.out.println("person");
    }

}

class Student extends Person {
    protected int score;

    public Student(String name, int age, int score) {
        super(name, age);//调用父类构造
        this.score = score;
    }

    void run(){
        System.out.println("children");
    }
}
//多态
interface  Car{
    void run();
    String getName();
}
class User implements  Car{
    public void run(){
        System.out.println("user");
    }

    @Override
    public String getName() {
        return "123";
    }
}

public class Main {
    public static void runTwice(Person p) {
        p.run();
    }
    public static void main(String[] args){
        FreshJuice juice = new FreshJuice();
        juice.size = FreshJuice.FreshJuiceSize.LARGE ;
        System.out.println(juice);
        System.out.println(juice.size);
        System.out.println(juice.sell());
        Student p =new Student("KK",15,88);
        runTwice(p);
        User u = new User();
        u.run();
        System.out.println(u.getName());
        System.out.println("-----");
        new  Student("KK",15,88).run();

    }


}